package reflect;

import reflect.annotations.AutoRunMethod;

import java.lang.reflect.Method;

/*
访问方法上的注解
 */
public class ReflectDemo10 {
    public static void main(String[] args) throws Exception{
        Class cla = Class.forName("reflect.Person");
        Method m = cla.getDeclaredMethod("sleep");
        boolean mark = m.isAnnotationPresent(AutoRunMethod.class);
        System.out.println(mark?"被注解了":"没有被注解");
    }
}
